/*
 * SPDX-FileCopyrightText: 2010-2022 Espressif Systems (Shanghai) CO LTD
 *
 * SPDX-License-Identifier: CC0-1.0
 */

#include <string.h>

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"

#include "bsp.h"
#include "bsp_led.h"
#include "bsp_key.h"
#include "bsp_wifi.h"
#include "bsp_mqtt.h"

#include "esp_lvgl.h"

#include <esp_log.h>
static const char *TAG = "main";

/**
 * @brief 在C文件中调用
 */
void handleMainProtocolParse(const char *topic, const char *payload, uint32_t payloadLen)
{
}

void mqttSubscribeList(const char *localIp, uint8_t *localMac)
{

    mqttSubscribe("sys/down");
}

void system_init(void)
{
    initialise_wifi();
    bsp_keyInit();
    bsp_ledInit();
    mqtt5_init();
    esp_lvgl_init();
}

void app_main(void)
{
    ESP_LOGI(TAG, "esp32s3-pio-idf");

    chip_info();
    system_init();

    while (1)
    {
        bsp_led_toggle();
        vTaskDelay(10 / portTICK_PERIOD_MS);
    }
}
